package exception;

public class ThrowDemo {
    public static void main(String[] args) {
        Person p = new Person();
        try {
            p.setAge(122);
            System.out.println(p.getAge());
        } catch (Exception e) {
            System.out.println("年龄非法");
        }
//        p.setAge(66);
//        System.out.println("此人的年龄是："+p.getAge()+"岁");
    }
}
